﻿@using Easy.Web.CMS.Zone
@model Easy.Web.CMS.Layout.LayoutEntity
@{
    if (Model == null)
    {
        return;
    }
}


@for (int i = 0; i < Model.Html.Count; i++)
{
    var item = Model.Html[i];
    if (item.Html == ZoneEntity.ZoneTag)
    {
        i++;
        var zoneId = Model.Html[i].Html;
        if (zoneId.IsNotNullAndWhiteSpace())
        {
            if (Model.ZoneWidgets.ContainsKey(zoneId))
            {
                foreach (var widgetPart in Model.ZoneWidgets[zoneId].OrderBy(m => m.Widget.Position).ThenBy(m => m.Widget.WidgetName))
                {
                    <div style="@widgetPart.Widget.CustomStyle">
                        <div class="widget @widgetPart.Widget.CustomClass">
                            @if (widgetPart.Widget.Title.IsNotNullAndWhiteSpace())
                            {
                                <div class="panel panel-default">
                                    <div class="panel-heading">

                                        <div class="title_left">
                                            <div class="title_next">
                                                @widgetPart.Widget.Title
                                            </div>
                                        </div>

                                            @if (!string.IsNullOrEmpty(widgetPart.Widget.MoreLink))
                                            {
                                                <a href="@Url.PathContent(widgetPart.Widget.MoreLink)" class="more_right" target="_blank">&nbsp;</a>
                                            }

                                            @if (!string.IsNullOrEmpty(widgetPart.Widget.PopLink))
                                            {
                                                <a id="@widgetPart.Widget.ID" ohref="@Url.PathContent(widgetPart.Widget.PopLink)" class="add_icon" style="text-decoration:none;" title="添加" href="javascript:void(0);">&nbsp;&nbsp;</a>
                                            }
                                    </div>
                                    <div class="panel-body" style=" padding:10px 0;">
                                        @Html.DisPlayWidget(widgetPart)
                                    </div>
                                </div>
                            }
                            else
                            {
                                @Html.DisPlayWidget(widgetPart)
                            }
                        </div>
                    </div>
                }
            }
        }
        i++;
    }
    else
    {
        @Html.Raw(item.Html)
    }
}

<link href="~/Modules/Common/Content/img/skin_2.css" rel="stylesheet" />

